using System.Data;
using ET;
namespace DAL
{
    public class Quotes_Product_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Quotes_Product(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_ID", id);
            return cls.GetData("sp_tb_Quotes_Product_Search");
        }
        public DataTable BindGirdtb_Quotes_Product_User(int id, int user)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_ID", id);
            cls.AddParameter("@User_ID", user);
            return cls.GetData("sp_tb_Quotes_Product_Search_User");
        }
        public DataTable SumQuotes(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_ID", id);
            return cls.GetData("sp_tb_Quotes_Product_Sum");
        }
        #endregion

        #region Insert
        public bool Inserttb_Quotes_Product(Quotes_Product_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Materials_Id", data.Materials_Id);
            cls.AddParameter("@Quotes_Product_Quantity", data.Quotes_Product_Quantity);
            cls.AddParameter("@Quotes_Product_Price", data.Quotes_Product_Price);
            cls.AddParameter("@Quotes_Product_VAT", data.Quotes_Product_VAT);
            cls.AddParameter("@Quotes_Product_VAT_Percent", data.Quotes_Product_VAT_Percent);
            cls.AddParameter("@Quotes_Product_TotalCash", data.Quotes_Product_TotalCash);
            cls.AddParameter("@Quotes_ID", data.Quotes_ID);
            cls.AddParameter("@User_ID", data.User_ID);
            return cls.ExecuteNonQuery("sp_tb_Quotes_Product_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Quotes_Product(Quotes_Product_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_Materials_ID", data.Quotes_Materials_ID);
            cls.AddParameter("@Materials_Id", data.Materials_Id);
            cls.AddParameter("@Quotes_Product_Quantity", data.Quotes_Product_Quantity);
            cls.AddParameter("@Quotes_Product_Price", data.Quotes_Product_Price);
            cls.AddParameter("@Quotes_Product_VAT", data.Quotes_Product_VAT);
            cls.AddParameter("@Quotes_Product_VAT_Percent", data.Quotes_Product_VAT_Percent);
            cls.AddParameter("@Quotes_Product_TotalCash", data.Quotes_Product_TotalCash);
            cls.AddParameter("@Quotes_ID", data.Quotes_ID);
            return cls.ExecuteNonQuery("sp_tb_Quotes_Product_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Quotes_Product(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_Materials_ID", id);
            cls.ExecuteNonQuery("sp_tb_Quotes_Product_Delete");
            return true;
        }
        public bool Deletetb_Quotes_Product_Default(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Quotes_ID", id);
            cls.ExecuteNonQuery("sp_tb_Quotes_Product_Delete_Default");
            return true;
        }
        #endregion
    }
}